/**
 * Copyright 2015 Hangzhou NetFrog Inc.
 *
 */
package com.m3958.logcollector.specs;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import org.springframework.data.jpa.domain.Specification;

import com.m3958.logcollector.domain.TreeBlob;
import com.m3958.logcollector.domain.TreeBlob_;

/**
 * @author jianglibo@gmail.com
 *         2015年7月20日
 *
 */
public class TreeBlobSpecs {
    
    public static Specification<TreeBlob> nameIs(String name) {
        return new Specification<TreeBlob>() {
            public Predicate toPredicate(Root<TreeBlob> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
                return builder.equal(root.get(TreeBlob_.name), name);
            }
        };
    }
}
